package com.mapper;

import com.pojo.TbUser;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

/**
* @author 海棠凤梨
* @description 针对表【tb_user】的数据库操作Mapper
* @createDate 2024-11-15 15:09:37
* @Entity com.pojo.TbUser
*/
public interface TbUserMapper {

    int deleteByPrimaryKey(Long id);

    int insert(TbUser record);

    int insertSelective(TbUser record);

    TbUser selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(TbUser record);

    int updateByPrimaryKey(TbUser record);

    @Select("select * from tb_user where id=#{id}")
    @Results({
            @Result(id =true,column = "id",property = "id"),
            @Result(column = "username",property = "username"),
            @Result(column = "address",property = "address"),
            @Result(column = "id",property = "ordersList",
                    many = @Many(select = "com.mapper.OrdersMapper.selectOrderByUserId"))
    })
    TbUser  selectUserById(int id);
}

